﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="get_news.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.News.get_news" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<body>
    <%
        int id = int.Parse(Request.QueryString["id"]);
        var get_news_top = (from p in new TblNewsController().FetchAll().Where(x => x.NewsCategory == id && x.NewsDelete == false && x.NewsTop == true) orderby p.NewsDate descending select p);
        var get_news_normal = (from p in new TblNewsController().FetchAll().Where(x => x.NewsCategory == id && x.NewsDelete == false && x.NewsTop != true) orderby p.NewsDate descending select p);
         %>
    <header class="w3-center w3-padding w3-large">Danh sách bài viết: <%=get_news_top.ToList().Count + get_news_normal.ToList().Count %> bài</header>
    <div class="student-list">
        <ul id="news_list" class="news-ad-list w3-ul w3-hoverable w3-white">
            <%foreach(TblNews news in get_news_top){ %>
            <li onclick="suabaiviet(<%=news.NewsId %>)" class="news<%=news.NewsId %> newslinks w3-row">
                <div class="w3-col l10"><%=news.NewsTitle %></div>
                <div class="w3-center w3-col l1 w3-right"><i class="fa fa-star w3-large w3-text-red"></i></div>
                <div class="w3-center w3-col l1 w3-right"><%if(news.NewsActive==true){ %><i class="fa fa-eye w3-large w3-text-orange"></i><%} %>&nbsp;</div>
            </li>
            <%}
              foreach(TblNews news in get_news_normal){
               %>
            <li onclick="suabaiviet(<%=news.NewsId %>)" class="news<%=news.NewsId %> newslinks w3-row">
                <div class="w3-col l10"><%=news.NewsTitle %></div>
                <div class="w3-center w3-col l1 w3-right">&nbsp;</div>
                <div class="w3-center w3-col l1 w3-right"><%if(news.NewsActive==true){ %><i class="fa fa-eye w3-large w3-text-orange"></i><%} %>&nbsp;</div>
            </li>
            <%} %>
        </ul>
    </div>
</body>
</html>
